Skip to main content

frozenset

>>> dir(frozenset)
['__and__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'copy', 'difference', 'intersection', 'isdisjoint', 'issubset', 'issuperset', 'symmetric_difference', 'union']
Dunder MethodOperationExample (normal syntax)Example (dunder call)
__contains__Membership2 in aa.__contains__(2)
__len__Lengthlen(a)a.__len__()
__iter__Iteratefor x in aa.__iter__()
__and__Intersectiona & ba.__and__(b)
__or__Union`ab`a.__or__(b)
__sub__Differencea - ba.__sub__(b)
__xor__Symmetric differencea ^ ba.__xor__(b)
__eq__Equalitya == ba.__eq__(b)
__hash__Hashhash(a)a.__hash__()